package com.fhz.kotlintest.databinding.base

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import androidx.fragment.app.Fragment

/**
 * 时间:2022/1/5
 * @author msfeng
 * 简述: TODO
 */
abstract class BaseViewFragment<V:ViewDataBinding> : Fragment() {

    protected lateinit var binding:V

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
//        val inflate = inflater.inflate(getLayoutId(), container, false)
//        binding = DataBindingUtil.bind<V>(inflate)

        binding = DataBindingUtil.inflate<V>(inflater, getLayoutId(), container, false)
        return binding.root
    }

    abstract fun getLayoutId(): Int
}